package com.health_predict_springboot.service.impl;

import com.health_predict_springboot.dao.SysAgeGroupMapper;
import com.health_predict_springboot.pojo.SysAgeGroup;
import com.health_predict_springboot.service.SysAgeGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SysAgeGroupServiceImpl implements SysAgeGroupService {

    @Autowired
    private SysAgeGroupMapper sysAgeGroupMapper;

    @Override
    public SysAgeGroup getAgeGroupById(Integer ageGroupId) {
        return sysAgeGroupMapper.selectByAgeGroupId(ageGroupId);
    }

    @Override
    public List<SysAgeGroup> getAllAgeGroups() {
        return sysAgeGroupMapper.selectAllAgeGroups();
    }

    @Override
    public boolean addAgeGroup(SysAgeGroup ageGroup) {
        return sysAgeGroupMapper.insertAgeGroup(ageGroup) > 0;
    }

    @Override
    public boolean updateAgeGroup(SysAgeGroup ageGroup) {
        return sysAgeGroupMapper.updateAgeGroup(ageGroup) > 0;
    }

    @Override
    public boolean deleteAgeGroup(Integer ageGroupId) {
        return sysAgeGroupMapper.deleteAgeGroup(ageGroupId) > 0;
    }

    @Override
    public List<SysAgeGroup> getAgeGroupsByPage(Map<String, Object> params) {
        return sysAgeGroupMapper.selectAgeGroupsByPage(params);
    }

    @Override
    public int getAgeGroupCount(Map<String, Object> params) {
        return sysAgeGroupMapper.selectAgeGroupCount(params);
    }
}